#!/usr/bin/env python 

import inkex
import simplestyle, sys
import andengineutils

class AndEngine(inkex.Effect):
    def __init__(self):
        """
        Constructor.
        Defines the "--what" option of a script.
        """
        # Call the base class constructor.
        inkex.Effect.__init__(self)
        
        # Define string option "--what" with "-w" shortcut and default value "World".
        self.OptionParser.add_option("--drawprimitives", action="store", type="inkbool", dest="drawprimitives", default=False, help="draw primitives")
        self.OptionParser.add_option("--curvesegments", action="store", type="int", dest="curvesegments", default=4, help="curve segments")
        
    def effect(self):
        for id, node in self.selected.iteritems():
            andengineutils.creatOrDelete("andengine-drawprimitives", node, self.options.drawprimitives, False)
            andengineutils.creatOrDelete("andengine-curvesegments", node, self.options.curvesegments, 4)
        
if __name__ == '__main__':
    e = AndEngine()
    e.affect()